<?php
list($start_usec, $start_sec) = explode(" ", microtime());
$start_time = ((float) $start_usec + (float) $start_sec);


$url = "http://localhost/mayi.php?a=b";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1 );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if(curl_errno($ch))
{
   curl_close($ch);
    exit;
}
var_dump($response);
$data="a=b&c=d";
curl_setopt($ch, CURLOPT_HEADER, 1 );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);
if(curl_errno($ch))
{
   curl_close($ch);
    exit;
}
var_dump($response);
 
curl_close($ch);
list($end_usec, $end_sec) = explode(" ", microtime());
$end_time = ((float) $end_usec + (float) $end_sec);
$total_time = 1000*($end_time - $start_time);
echo "<BR>总计耗时：".$total_time."毫秒 <BR>";


?>
